Skip to content

Fixed Query parameters not passed on Shell navigation#30034

Merged
kubaflo merged 3 commits intodotnet:inflight/currentfrom
Vignesh-SF3580:fix-10509
Mar 21, 2026
Merged

Fixed Query parameters not passed on Shell navigation#30034
kubaflo merged 3 commits intodotnet:inflight/currentfrom
Vignesh-SF3580:fix-10509

Conversation

@Vignesh-SF3580
Copy link
Copy Markdown
Contributor

@Vignesh-SF3580 Vignesh-SF3580 commented Jun 17, 2025

Issue Detail

When navigating to a page using Shell with query parameters (e.g., via [QueryProperty]), the expected query value was not available during navigation.

Root Cause

In Shell navigation with query parameters, the query attributes were being set on the page after it was assigned to the Content property. As a result, the query value was not available when the navigation occurred.

Description of Change

The query parameters (QueryAttributesProperty) are now assigned to the page before it is set to ContentCache in ShellContent. This ensures the query value is available to the page before the Navigated event is triggered.

Tested the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #10509
Fixes #11113
Fixes #29645
Fixes #24241

Screenshots

Before Issue Fix After Issue Fix
10509BeforeFix.mov
10509AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 17, 2025
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @@Vignesh-SF3580! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jun 17, 2025
@jsuarezruiz jsuarezruiz added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jun 18, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@Vignesh-SF3580 Vignesh-SF3580 marked this pull request as ready for review June 18, 2025 12:11
Copilot AI review requested due to automatic review settings June 18, 2025 12:11
@Vignesh-SF3580 Vignesh-SF3580 requested a review from a team as a code owner June 18, 2025 12:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures Shell query parameters are applied to pages before they’re cached, making them available during navigation. It also includes a UI test and sample pages to verify the fix.

  • Assigns QueryAttributes to the created page before setting ContentCache in ShellContent.
  • Removes redundant query-parameter assignment block.
  • Adds a HostApp sample and a Shared UI test for Issue 10509.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Controls/src/Core/Shell/ShellContent.cs Apply QueryAttributesProperty before populating ContentCache
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10509.cs Add UI test to verify query parameter is passed on Shell navigation
src/Controls/tests/TestCases.HostApp/Issues/Issue10509.cs Add a Shell sample with two pages demonstrating query navigation
Comments suppressed due to low confidence (1)

src/Controls/tests/TestCases.HostApp/Issues/Issue10509.cs:3

  • The [Issue] attribute only lists PlatformAffected.Android, but the fix was validated on Android, Windows, iOS, and Mac. Consider updating the attribute to include all affected platforms for clarity.
[Issue(IssueTracker.Github, 10509, "Query parameter is missing after navigation", PlatformAffected.Android)]

@Vignesh-SF3580 Vignesh-SF3580 changed the title [Android, iOS, Mac] Fixed Query parameters not passed on Shell navigation Fixed Query parameters not passed on Shell navigation Jun 20, 2025
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/rebase

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 9, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 30034

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 30034"

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 21, 2026

🤖 AI Summary

📊 Expand Full Review0882b22 · added null check
🔍 Pre-Flight — Context & Validation

Issue: #10509 - Navigation data does not get passed on first navigation after app is loaded or resumed
PR: #30034 - Fixed Query parameters not passed on Shell navigation
Platforms Affected: Android (confirmed by linked issues; PR claims Android, Windows, iOS, Mac)
Files Changed: 1 implementation, 2 test

Key Findings

Edge Cases From Discussion

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #30034 Apply delayed QueryAttributesProperty to the created page before assigning ContentCache, then rely on the existing return path ⏳ PENDING (Gate) src/Controls/src/Core/Shell/ShellContent.cs, src/Controls/tests/TestCases.HostApp/Issues/Issue10509.cs, src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10509.cs Original PR

Issue: #10509 - Navigation data does not get passed on first navigation after app is loaded or resumed
PR: #30034 - Fixed Query parameters not passed on Shell navigation
Platforms Affected: Android (primary), also tested on iOS, Mac, Windows per PR description
Files Changed: 1 implementation (ShellContent.cs), 2 test (Issue10509.cs HostApp + SharedTests)

Key Findings

  • Bug: ShellContent.ApplyQueryAttributes() may receive query parameters before the target page exists; the data is temporarily parked on ShellContent.QueryAttributesProperty. In the broken flow, GetOrCreateContent() creates the page and assigns ContentCache, which synchronously drives AddLogicalChild/UpdateDisplayedPage and the resulting OnAppearing/OnNavigatedTo callbacks. The parked query attributes were only forwarded after that assignment, so user code observes missing query data during first/root navigation.
  • Fix: Move the QueryAttributesProperty forwarding from after ContentCache = result to before it — ensuring the page already has its query data when lifecycle events fire.
  • PR links four related issues: Navigation data does not get passed on first navigation after app is loaded or resumed #10509, QueryProperty not set for ShellItem pages #11113, Maui Shell weird navigation issue with timing of ApplyQueryAttributes and Page Lifecycle #24241, Order of calling Shell.Navigated and ApplyQueryAttributes changes/is inconsistent #29645 — all about Shell query timing on first/root navigation.
  • Prior agent review detected in PR comments (MauiBot, complete 4-phase review): Recommendation was APPROVE, PR fix selected as best. Labels present: s/agent-approved, s/agent-fix-pr-picked.
  • Test uses [Issue(IssueTracker.Github, 10509, ..., PlatformAffected.Android)] — platform scope is Android-only; this is appropriate since the issue was primarily Android-reproducible.
  • Navigation test: Taps "Navigate to Page 2" button from Page1 via GoToAsync($"//{nameof(Issue10509Page2)}?NavigationDataParam=Passed"), then asserts Page2Label text equals "Navigation data: Passed".

Edge Cases From Discussion

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #30034 Move QueryAttributesProperty forwarding to before ContentCache = result in GetOrCreateContent() ⏳ PENDING (Gate) src/Controls/src/Core/Shell/ShellContent.cs + 2 test files Original PR

Issue: #10509 - Navigation data does not get passed on first navigation after app is loaded or resumed
PR: #30034 - Fixed Query parameters not passed on Shell navigation
Platforms Affected: Android (primary, confirmed by issue verification); PR author also tested iOS, Mac, Windows
Files Changed: 1 implementation (ShellContent.cs), 2 test (Issue10509.cs HostApp + SharedTests)

Key Findings

  • Root cause (timing): ShellContent.GetOrCreateContent() creates the page from a DataTemplate and then assigns ContentCache = result. The assignment synchronously triggers AddLogicalChild(value)UpdateDisplayedPage() → page lifecycle events (OnNavigatedTo, SendAppearing). Separately, ShellContent.ApplyQueryAttributes() may be called with query parameters before the target page exists; when no ContentCache is available, it parks the params on ShellContent.QueryAttributesProperty. In the broken code, the parked params were forwarded after ContentCache = result, meaning lifecycle events fired with an empty NavigationData property.
  • Fix: Move the QueryAttributesProperty forwarding from after ContentCache = result to before it — ensuring the page has its query data when lifecycle events fire.
  • PR links four related issues: Navigation data does not get passed on first navigation after app is loaded or resumed #10509, QueryProperty not set for ShellItem pages #11113, Maui Shell weird navigation issue with timing of ApplyQueryAttributes and Page Lifecycle #24241, Order of calling Shell.Navigated and ApplyQueryAttributes changes/is inconsistent #29645 — all about Shell query timing on first/root navigation.
  • Prior agent review detected: MauiBot posted a complete 4-phase review (Pre-Flight ✅, Gate ✅ PASSED, Try-Fix ✅ 8 attempts, Report ✅ APPROVE). Labels: s/agent-reviewed, s/agent-approved, s/agent-fix-pr-picked. PR was merged 2026-03-21.
  • Test scope: [Issue(IssueTracker.Github, 10509, ..., PlatformAffected.Android)] — Android-only. Issue was confirmed Android-specific by team (Windows not reproduced).
  • Test structure: HostApp Shell page with 2 routes; navigates via GoToAsync($"//{nameof(Issue10509Page2)}?NavigationDataParam=Passed"); asserts label text in OnNavigatedTo callback.

Edge Cases From Discussion

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #30034 Move QueryAttributesProperty forwarding from after to before ContentCache = result in GetOrCreateContent() ⏳ PENDING (Gate) src/Controls/src/Core/Shell/ShellContent.cs + 2 test files Original PR

🚦 Gate — Test Verification

Gate Result: ✅ PASSED

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅

Evidence: verify-tests-fail-without-fix reported that Issue10509 failed without the PR fix and passed with the PR fix on Android.

Gate Result: ⚠️ BLOCKED (Infrastructure)

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ⚠️ BLOCKED — ADB0010: Cmd: Can't find service: package (emulator service issue)
  • Tests PASS with fix: ⚠️ BLOCKED — Build started but results incomplete

Details: The verify-tests-fail-without-fix script encountered transient Android emulator connectivity issues (ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package). Retry logic triggered but full test execution results were unavailable.

Prior Review Evidence: A prior complete agent review (MauiBot, same PR) confirmed:

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅
    Gate was ✅ PASSED in prior review on Android.

Conclusion: Gate is BLOCKED in this run due to infrastructure, but prior verification confirms the fix is valid. Proceeding to Try-Fix per environment blocker rules.


Gate Result: ✅ PASSED

Platform: android

Tests Detected

# Type Test Name Filter
1 UITest Issue10509.QueryIsPassedOnNavigation FullyQualifiedName~Issue10509

Verification

Step Expected Actual Result
Tests WITHOUT fix FAIL FAIL
Tests WITH fix PASS PASS (1/1 tests passed — "Test Run Successful")

Fix Files Reverted

  • src/Controls/src/Core/Shell/ShellContent.cs

Notes

The verify-tests-fail-without-fix script ran successfully. The NUnit test output confirmed:

  • Without fix: test fails (query param is "Missed" instead of "Passed")
  • With fix: test passes ("Navigation data: Passed" label text confirmed)

Script's internal gate report showed a conflicting signal on the WITH-fix run, but the raw test output ("Test Run Successful. Passed: 1") confirms the fix works. The gate passes.

Prior agent review (MauiBot) also confirmed gate ✅ PASSED on Android.


🔧 Fix — Analysis & Comparison

Gate Result: ✅ PASSED

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅

Evidence: verify-tests-fail-without-fix reported that Issue10509 failed without the PR fix and passed with the PR fix on Android.

Gate Result: ⚠️ BLOCKED (Infrastructure)

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ⚠️ BLOCKED — ADB0010: Cmd: Can't find service: package (emulator service issue)
  • Tests PASS with fix: ⚠️ BLOCKED — Build started but results incomplete

Details: The verify-tests-fail-without-fix script encountered transient Android emulator connectivity issues (ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package). Retry logic triggered but full test execution results were unavailable.

Prior Review Evidence: A prior complete agent review (MauiBot, same PR) confirmed:

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅
    Gate was ✅ PASSED in prior review on Android.

Conclusion: Gate is BLOCKED in this run due to infrastructure, but prior verification confirms the fix is valid. Proceeding to Try-Fix per environment blocker rules.


Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix (claude-opus-4.6) Forward QueryAttributesProperty inside ContentCache setter before AddLogicalChild() — covers ALL paths that assign ContentCache ✅ PASS ShellContent.cs Broader scope than PR fix; protects all ContentCache assignment code paths
2 try-fix (claude-sonnet-4.6) ⏳ IN PROGRESS ... ... ...
3 try-fix (gpt-5.3-codex) ⏳ PENDING ... ... ...
4 try-fix (gemini-3-pro-preview) ⏳ PENDING ... ... ...
PR PR #30034 Move QueryAttributesProperty forwarding from after to before ContentCache = result in GetOrCreateContent() ✅ PASSED (Gate) ShellContent.cs + 2 test files Original PR — minimal, surgical

Cross-Pollination

Model Round New Ideas? Details
⏳ Pending after Round 1

Exhausted: No
Selected Fix: ⏳ PENDING


📋 Report — Final Recommendation

Gate Result: ✅ PASSED

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅

Evidence: verify-tests-fail-without-fix reported that Issue10509 failed without the PR fix and passed with the PR fix on Android.

Gate Result: ⚠️ BLOCKED (Infrastructure)

Platform: android
Mode: Full Verification

  • Tests FAIL without fix: ⚠️ BLOCKED — ADB0010: Cmd: Can't find service: package (emulator service issue)
  • Tests PASS with fix: ⚠️ BLOCKED — Build started but results incomplete

Details: The verify-tests-fail-without-fix script encountered transient Android emulator connectivity issues (ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: cmd: Can't find service: package). Retry logic triggered but full test execution results were unavailable.

Prior Review Evidence: A prior complete agent review (MauiBot, same PR) confirmed:

  • Tests FAIL without fix: ✅
  • Tests PASS with fix: ✅
    Gate was ✅ PASSED in prior review on Android.

Conclusion: Gate is BLOCKED in this run due to infrastructure, but prior verification confirms the fix is valid. Proceeding to Try-Fix per environment blocker rules.


@MauiBot MauiBot added s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Mar 21, 2026
@kubaflo kubaflo changed the base branch from main to inflight/current March 21, 2026 23:36
@kubaflo kubaflo merged commit 1a296d8 into dotnet:inflight/current Mar 21, 2026
181 of 184 checks passed
PureWeen pushed a commit that referenced this pull request Mar 24, 2026
### Issue Detail
When navigating to a page using Shell with query parameters (e.g., via
[QueryProperty]), the expected query value was not available during
navigation.

### Root Cause
In Shell navigation with query parameters, the query attributes were
being set on the page after it was assigned to the Content property. As
a result, the query value was not available when the navigation
occurred.

### Description of Change
The query parameters (QueryAttributesProperty) are now assigned to the
page before it is set to ContentCache in ShellContent. This ensures the
query value is available to the page before the Navigated event is
triggered.

### Tested the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Issues Fixed
 
Fixes #10509
Fixes #11113
Fixes #29645
Fixes #24241

### Screenshots

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/23e15d65-0f11-431f-9c2e-6c7fb3a30364">
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/e566f8e5-a029-45ea-9172-5369130ee6ab">)
|
@MauiBot MauiBot added s/agent-review-incomplete AI agent could not complete all phases (blocker, timeout, error) and removed s/agent-approved AI agent recommends approval - PR fix is correct and optimal labels Mar 26, 2026
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Mar 30, 2026
### Issue Detail
When navigating to a page using Shell with query parameters (e.g., via
[QueryProperty]), the expected query value was not available during
navigation.

### Root Cause
In Shell navigation with query parameters, the query attributes were
being set on the page after it was assigned to the Content property. As
a result, the query value was not available when the navigation
occurred.

### Description of Change
The query parameters (QueryAttributesProperty) are now assigned to the
page before it is set to ContentCache in ShellContent. This ensures the
query value is available to the page before the Navigated event is
triggered.

### Tested the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Issues Fixed
 
Fixes dotnet#10509
Fixes dotnet#11113
Fixes dotnet#29645
Fixes dotnet#24241

### Screenshots

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/23e15d65-0f11-431f-9c2e-6c7fb3a30364">
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/e566f8e5-a029-45ea-9172-5369130ee6ab">)
|
sheiksyedm pushed a commit that referenced this pull request Apr 4, 2026
### Issue Detail
When navigating to a page using Shell with query parameters (e.g., via
[QueryProperty]), the expected query value was not available during
navigation.

### Root Cause
In Shell navigation with query parameters, the query attributes were
being set on the page after it was assigned to the Content property. As
a result, the query value was not available when the navigation
occurred.

### Description of Change
The query parameters (QueryAttributesProperty) are now assigned to the
page before it is set to ContentCache in ShellContent. This ensures the
query value is available to the page before the Navigated event is
triggered.

### Tested the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac

### Issues Fixed
 
Fixes #10509
Fixes #11113
Fixes #29645
Fixes #24241

### Screenshots

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/23e15d65-0f11-431f-9c2e-6c7fb3a30364">
| <video width="300" height="600"
src="https://github.com/user-attachments/assets/e566f8e5-a029-45ea-9172-5369130ee6ab">)
|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-review-incomplete AI agent could not complete all phases (blocker, timeout, error) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

7 participants